package org.renhj.discovery;

import org.apache.curator.framework.recipes.cache.PathChildrenCacheListener;

import java.util.List;

public abstract class Discovery {

    private final static String PATH_SEPARATOR="/";

    String pathJoin(String... paths) {
        StringBuilder sb = new StringBuilder();
        for (String path : paths) {
            sb.append(PATH_SEPARATOR).append(path);
        }
        return sb.toString();
    }

    public abstract List<String> discovery(String service) throws Exception;

    public abstract void registerListener(String service, PathChildrenCacheListener listener) throws Exception;

}
